#include "stm32f10x.h"                  // Device header
#include "Motor.h"
#include "Delay.h"
#include "pwm.h"

void Car_Init(){
	Motor_Init();
}
void Go_Ahead(int16_t Speed){
	Motor_SetLeftSpeed(-Speed);
	Motor_SetRightSpeed(-Speed);		
}
void Go_Back(int16_t Speed){
	Motor_SetLeftSpeed(Speed);
	Motor_SetRightSpeed(Speed);
}
void Turn_Left(int16_t Speed){
	    GPIO_SetBits(GPIOA, GPIO_Pin_4);
		GPIO_SetBits(GPIOA, GPIO_Pin_5);
		PWM_SetCompare3(80);///???

	    GPIO_SetBits(GPIOA, GPIO_Pin_7);
		GPIO_ResetBits(GPIOA, GPIO_Pin_6);
		PWM_SetCompare4(Speed);
}
void Turn_Right(int16_t Speed){
		
		GPIO_SetBits(GPIOA, GPIO_Pin_6);
		GPIO_SetBits(GPIOA, GPIO_Pin_7);
		PWM_SetCompare4(80);///???
	
        GPIO_SetBits(GPIOA, GPIO_Pin_4);
		GPIO_ResetBits(GPIOA, GPIO_Pin_5);
		PWM_SetCompare3(Speed);
	
}
void Self_Left(int16_t Speed){
	Motor_SetLeftSpeed(Speed);
	Motor_SetRightSpeed(-Speed);
}
void Self_Right(int16_t Speed){
	Motor_SetLeftSpeed(-Speed);
	Motor_SetRightSpeed(Speed);
}
void Car_Stop(int16_t Speed){
	Motor_SetLeftSpeed(0);
	Motor_SetRightSpeed(0);

}
